fix: make doctor current-project check resolution-aware#180
Conversation
The doctor "Current project" check used the synchronous TraceDecay::is_initialized, which only looks for a repo-local .tracedecay/ index. On machines using profile-sharded stores it reported "No index — run `tracedecay init`" even though the project resolved to a fully indexed profile store, steering users into a redundant re-init. Resolve the store through the same registry/alias-aware path the real tools use (via the new TraceDecay::initialized_store_layout_with_options, shared with has_initialized_store), report the resolved store location, mode, and id, measure DB size at the resolved graph DB path, and only advise `tracedecay init` when resolution genuinely finds nothing.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6fcc5f56ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
check_database previously measured a caller-supplied db path that could differ from the DB TraceDecay::open actually serves (e.g. a branch- specific DB), making the VACUUM size report inaccurate. Derive the path from the opened instance instead, which also drops the threaded db_path parameter and the LegacyRepoLocal payload field.
Summary
tracedecay doctor's "Current project" check used the synchronousTraceDecay::is_initialized, which only looks for a repo-local.tracedecay/index; on profile-sharded setups it falsely warned "No index — runtracedecay init" for fully indexed projects (e.g. worktrees resolved via the git-common-dir alias to a profile store likeproj_b4a8bbe4953823c4).TraceDecay::initialized_store_layout_with_options, shared withhas_initialized_store) and reports the resolved data root, storage mode, and store id; DB size is measured at the resolved graph DB path instead of the repo-local marker path.tracedecay initis only advised when resolution genuinely finds nothing (no resolvable store and no legacy repo-local DB).Test plan
cargo check --all-targetsandcargo clippy --all-targetscleandoctor::tests::current_project_store_resolves_profile_shard_via_registry_aliascovers the profile-sharded case (registry alias resolution with no repo-local index) and the genuinely-uninitialized case, using an isolated profile root + global DB (no~/.tracedecaypollution)storage_resolver_testandprofile_storage_migration_testpass withTRACEDECAY_DATA_DIRpointed at a tempdir